package com.flymobi.admin;

import java.util.List;

import com.flymobi.fw.modules.SM;
import com.flymobi.po.Manager;
import com.flymobi.po.Qudao;
import com.flymobi.util.C;
import com.flymobi.util.Pagination;
import com.flymobi.util.WebContext;

/**
 * 
 * 
 * Title:
 * 
 * Description:
 * 
 * Copyright: Copyright (c) 2008
 * 
 * @author haoxz11
 * @created Oct 21, 2008 11:16:42 AM
 * @version $Id: ManagerAction.java,v 1.1 2010/04/09 03:27:08 airsou Exp $
 */
public class QudaoAction extends WebAction {
	/*
	 * private String method; private String id;
	 */
	private Qudao qudao;

	/**
	 * @return the qudao
	 */
	public Qudao getQudao() {
		return qudao;
	}

	/**
	 * @param qudao
	 *            the qudao to set
	 */
	public void setQudao(Qudao qudao) {
		this.qudao = qudao;
	}

	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String webProcess(WebContext context, Manager manager) {
		if ("add".equals(method)) {
			return "edit";
		} else if ("edit".equals(method)) {
			Qudao qudao = SM.QudaoService.get(id);
			context.put("qudao", qudao);
			return "edit";
		} else if ("delete".equals(method)) {
			SM.QudaoService.delete(id);
			context.put("rmsg", C.TEXT.DELETE_SUCCESS);
			method = "list";
			return this.webProcess(context, manager);
		} else if ("save".equals(method)) {
			SM.QudaoService.save(qudao);
			context.put("rmsg", C.TEXT.SAVE_SUCCESS);
			method = "list";
			return this.webProcess(context, manager);
		} else if ("list".equals(method)) {
			List<Qudao> qudaoList = SM.QudaoService.list(startRow, pagePerSize);
			context.put("qudaoList", qudaoList);
			context.put("pagenation", new Pagination(SM.QudaoService.getCount()
					.intValue(), startRow, pagePerSize));
			return "list";
		} else {
			method = "list";
			return this.webProcess(context, manager);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.camel.admin.WebAction#getSysLog()
	 */
	@Override
	public String getSysLog() {
		String opr = "";

		return opr;
	}
}
